<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:p="http://primefaces.org/ui" template="/layout/template.xhtml">
  <ui:define name="body">
  <script language="JavaScript" type="text/javascript">
		window.history.forward(-1);
	</script>
  <h1 class="title ui-widget-header ui-corner-all">Horario del Personal</h1>
<h:form id="horarioPersonal">
<p:messages showDetail="true" />
<p:fieldset legend="Buscar Personal" style="margin-top:20px">
<h:panelGrid columns="2"  >
<p:outputLabel value="Cargo :" for="cargo" />
<p:selectOneMenu id="cargo" value="#{comboAction.cargoEmpleado}">
<f:selectItems  value="#{comboAction.cargoEmpleadoItems}" />
 <p:ajax update="empleado"  listener="#{comboAction.cambiar2}" />  
</p:selectOneMenu>
<p:outputLabel value="Empleado :" for="empleado" />
<p:selectOneMenu id="empleado" value="#{horarioPersonal.idempleado}"  >
<f:selectItems  value="#{comboAction.empleadoxcargo}" />
</p:selectOneMenu>
<p:commandButton value="Buscar" ajax="false" icon="ui-icon-search" action="#{horarioPersonal.mostrar}" />
</h:panelGrid>
</p:fieldset>

	<p:fieldset legend="Horario Personal : #{horarioPersonal.objHorarioPersonal.tbEmpleado.nombresCompletos}" style="margin-top:20px" >

<p:commandButton  value="Registrar nuevo Horario" action="#{horarioPersonal.agregarhorario}"
icon="ui-icon-star"  
oncomplete="horarioDialog.show()"  update=":formManteHorarioPers:display"  />
<p:spacer></p:spacer>
<p:dataTable var="h" value="#{horarioPersonal.listaHorario}" id="horarioPersonalList" editable="true"  
 rowStyleClass="#{h.diainicio le horarioPersonal.dhoy ? null: 'colorPlomo' }"  >
		
			<p:column headerText="Dia">
				<h:outputText value="#{h.tbFecha.dia}" />
			</p:column>
			<p:column headerText="Entrada">
				<h:outputText value="#{h.horaIngreso}" />
			</p:column>
			<p:column headerText="Salida">
				<h:outputText value="#{h.horaSalida}" />
			</p:column>
			<p:column headerText="Dia inicio">
				<h:outputText value="#{h.diainicio}" />
			</p:column>
			<p:column headerText="Dia Fin">
				<h:outputText value="#{h.diafin}" />
			</p:column>
			  <p:column headerText="Editar">
			  <center>
	    <p:commandButton 
		 action="#{horarioPersonal.update}" 
		 oncomplete="horarioDialog.show()" 
		icon=" ui-icon-pencil"
 
		  update=":formManteHorarioPers:display"  >
		 <f:setPropertyActionListener value="#{h}"  
		  target="#{horarioPersonal.objHorarioPersonal}" />
		</p:commandButton>
		</center>
	   </p:column>
	   
	     <p:column headerText="Deshabilitar">
	     <center>
	    <p:commandButton id="showConfirmHorarioPersonal12"
						 onclick="confirmDeshabilitarHorario.show()"    
						  icon="ui-icon ui-icon-close"	>
						  
		 <f:setPropertyActionListener value="#{h.idhorariopersonal}"  
		  target="#{horarioPersonal.idhorario}" />
		</p:commandButton>
		</center>
	   </p:column>
		</p:dataTable>
</p:fieldset>
<p:fieldset legend="Visualizar Horario" style="margin-top:20px">
    <p:schedule value="#{horarioPersonal.eventModel}" draggable="false" resizable="false" locale="tr"  />  
</p:fieldset>
</h:form>
</ui:define>
</ui:composition>